# https://zhuanlan.zhihu.com/p/70720129
# tree traverse

class TreeNode:    
    def __init__(self, x):
        self.val = x
        self.left = None
        self.right = None
    
    def add_left(self,node):
        self.left = node
    
    def add_right(self,node):
        self.right = node

# depth first search
def print_dfs(root):
    if not root:
        return 
    print(root.val)
    print_dfs(root.left)
    print_dfs(root.right)

my_tree = TreeNode(3) 
my_tree.add_left(TreeNode(4))
my_tree.add_right(TreeNode(2))
my_tree.left.add_left(TreeNode(11))

print_dfs(my_tree)

# dfs

pass